<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML>
<html style='height:100%;'>
<head>
<base href="<%=basePath%>">

<title>巡查新增</title>
<link rel="stylesheet" href="css/vivo.css">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="js/bootstrap2/css/bootstrap.min.css">
<link rel="stylesheet" href="css/common.css">
<link href="js/select2/select2.min.css" type="text/css" rel="stylesheet" />
<link rel="stylesheet" type="text/css"
	href="static/p_house/house_index.css" />
<link rel="stylesheet" type="text/css"
	href="js/webuploader-0.1.5/webuploader.css" />

<script src="js/jquery-1.11.1.js"></script>
<script src="js/bootstrap2/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/layui-v2.1.5/layui/layui.all.js"></script>
<script type="text/javascript" src="<%=basePath%>js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="js/webuploader-0.1.5/webuploader.js"></script>
<script type="text/javascript" src="js/sharefunction.js"></script>
<script src="js/select2/select2.min.js"></script>
<script type="text/javascript" src="js/form.js"></script>
<!-- 图片放大 -->
<script src="js/postbird-img-glass/postbird-img-glass.js"></script>
<!-- 装修巡查 -->
<script type="text/javascript">
	var s2ExamineContent;
	$(document).ready(function() {
		s2ExamineContent = $("#examineContent").select2({
			tags : true
		});
		initExamineContent();
		var manFlag = '${manFlag}';
		if(manFlag == '1'){
			//隐藏按钮
			$("#man_div").find("input,textarea:not([name=approvalRemark])").attr("readonly", true);
			$("#man_div").find(".addbtn,select,input[type='file'],.Wdate").attr("disabled", true);
			$("#man_div input[name='isfraud']").attr("disabled", true);
		}
		//悬浮提示
		toolTip();
		//修改字段标记记录变量
		<c:set var="marks" value="原数据"/>
			
	});
	
	//展示附件
  	var acIds ="";//新增附件id集合
	function getFiles() {
	  	//原附件状态为1
	  	getFileListByFlag($("#man_div #entityId_id").val(), "违规现象",2, "#list_wgxx", setRFL,imgPlus);
	  	<c:if test="${requestScope.notPassExamine}">
		  	var caList = ${requestScope.caList};
		  	//获取序列化操作时的图片数据
			for(var i = 0;i<caList.length;i++){
				acIds += caList[i].accessoryCAId+",";
			} 
			acIds = acIds.substring(0,acIds.length-1);
			getFileListByAcId(acIds,"#list_wgxx",imgPlus);
		</c:if>
	}
	//设置待删除附件的值到集合中
	function setRFL(id, _this) {
		layer.confirm('删除该图片？', {
			title : '警告',
			icon : 0,
			shade : [ 0.1, '#fff' ]
		}, function() {
			//删除指定缩略图
			$("#" + id).remove();
			layer.close(layer.index);
		});
	}
	function imgPlus(data) {
		$("#man_div .uploadcancel").css("display", "none");
		$.each(data, function(i, v) {
			//图片放大
			PostbirdImgGlass.init({
				domSelector : "#" + v.id + " img",
				animation : true,
				myDocument : window.parent.parent.parent
			});
		});
	}
	var rFileList = ""; //
	//设置待删除附件的值到集合中
	function setRFL(id, _this) {
		layer.confirm('删除该图片？', {
			title : '警告',
			icon : 0,
			shade : [ 0.1, '#fff' ]
		}, function() {
			//rFileList.push(id);
			rFileList=id+","+rFileList
			//删除指定缩略图
			$("#" + id).remove();
			layer.close(layer.index);
		});
	}

	function initExamineContent() {
		var html = "";
		var arr = [ "人员巡查", "消防巡查", "安全巡查", "卫生巡查", "水电巡查", "超违处理" ];
		for (var i = 0; i < arr.length; i++) {
			html = "<option value=\"" + arr[i] + "\">" + arr[i] + "</option>";
			$("#examineContent").append(html);
		}
	}

	function saveMan(opt){
		var url = "customer/dm/disposeDecorateMan";
		var apId = '${requestScope.apId }';
		var exDataId = '${exDataId}';
		var approvalRemark = $("textarea[name='approvalRemark']").val();
		var formData = {
				exDataId:exDataId,
	        	opt:opt,
	        	apId:apId,
	        	approvalRemark:approvalRemark
	    };
		disposeSave(opt,url,formData);
	}
</script>
</head>
<body>
	<div id="man_div">
		<div class="panel panel-default">
			<div class="panel-body">
				<input type="hidden" id="decoration_articleId">
				<table cellpadding="10" cellspacing="5" class="mytable">
					<tr>
						<td width="70">巡视时间</td>
						<td><input name="examineDate" id="examineDate" class="Wdate"  readonly="readonly"
							onClick="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss'})" 
							value="<fmt:formatDate value="${requestScope.dm.examineDate }" pattern="yyyy-MM-dd" />"/> <span></span>
							<c:if test="${not empty requestScope.map.examineDate }"><span class="toolTip mark-msg" data-tip="<fmt:formatDate  value="${requestScope.map.examineDate }" type="both" pattern="yyyy-MM-dd" />">
								<c:out value="${marks}"/></span>
							</c:if>
							<c:if test="${requestScope.map.examineDate=='' }"><span class="toolTip mark-msg"data-tip="空">
								<c:out value="${marks}"/></span>
							</c:if>
						</td>
					</tr>
					<tr>
						<!-- 当前登录人    未完待续。。。 -->
						<td width="70">巡视人员</td>
						<td><input name="fkexaminePerson" id="fkexaminePerson" value="${requestScope.dm.fkexaminePerson }" />
							<c:if test="${not empty requestScope.map.fkexaminePerson }"><span class="toolTip mark-msg"data-tip="${requestScope.map.fkexaminePerson }">
								<c:out value="${marks}"/></span>
							</c:if>
							<c:if test="${requestScope.map.fkexaminePerson=='' }"><span class="toolTip mark-msg"data-tip="空">
								<c:out value="${marks}"/></span>
							</c:if>
						</td>
					</tr>
					<tr>
						<td width="70">巡视内容</td>
						<td><select class="js-example-tags" name="examineContent"id="examineContent" style="width:135px;" ">
							<option value="${requestScope.dm.examineContent }">${requestScope.dm.examineContent }</option>
						</select>
							<c:if test="${not empty requestScope.map.examineContent }"><span class="toolTip mark-msg"data-tip="${requestScope.map.examineContent }">
								<c:out value="${marks}"/></span>
							</c:if>
							<c:if test="${requestScope.map.examineContent=='' }"><span class="toolTip mark-msg"data-tip="空">
								<c:out value="${marks}"/></span>
							</c:if>
						</td>
					</tr>
					<tr>
						<td width="70" id="examine">人员巡查</td>
						<td><textarea rows="3" cols="70" style="width:70%"name="examineRecord" id="examineRecord">${requestScope.dm.examineRecord }</textarea>
							<c:if test="${not empty requestScope.map.examineRecord }"><span class="toolTip mark-msg"data-tip="${requestScope.map.examineRecord }">
								<c:out value="${marks}"/></span>
							</c:if>
							<c:if test="${requestScope.map.examineRecord=='' }"><span class="toolTip mark-msg"data-tip="空">
								<c:out value="${marks}"/></span>
							</c:if>
						</td>
					</tr>
					<tr>
						<td width="70">是否违规</td>
						<td>
							<c:choose>
								<c:when test="${requestScope.dm.isfraud == 0 }">
									<input type="radio" name="isfraud" id="isfraud" value="0"style="cursor:pointer;" checked="checked">否 
									<input type="radio" name="isfraud" id="isfraud" value="1" style="cursor:pointer;">是
								</c:when>
								<c:otherwise>
									<input type="radio" name="isfraud" id="isfraud" value="0"style="cursor:pointer;">否 
									<input type="radio" name="isfraud" id="isfraud" value="1" style="cursor:pointer;" checked="checked">是
								</c:otherwise>
							</c:choose>
						</td>
					</tr>
					<c:if test="${requestScope.dm.isfraud == 1 }">
						<tr class="weigui">
							<td width="70">违规处理</td>
							<td>
								<textarea rows="3" cols="70" style="width:70%" name="fraudDispose" id="fraudDispose">${requestScope.dm.fraudDispose }</textarea>
								<c:if test="${not empty requestScope.map.fraudDispose }"><span class="toolTip mark-msg"data-tip="${requestScope.map.fraudDispose }">
								<c:out value="${marks}"/></span>
								</c:if>
								<c:if test="${requestScope.map.fraudDispose=='' }"><span class="toolTip mark-msg"data-tip="空">
									<c:out value="${marks}"/></span>
								</c:if>
							</td>
						</tr>
						<tr class="weigui">
							<td>违规现象</td>
							<td colspan="3"><input name="fraudImg" id="fraudImg"value="${requestScope.dm.fraudImg }" />
								<c:if test="${not empty requestScope.map.fraudImg }"><span class="toolTip mark-msg"data-tip="${requestScope.map.fraudImg }">
								<c:out value="${marks}"/></span>
								</c:if>
								<c:if test="${requestScope.map.fraudImg=='' }"><span class="toolTip mark-msg"data-tip="空">
									<c:out value="${marks}"/></span>
								</c:if>
								 <!-- 上传按钮 -->
								<div id='filePicker_wgxx' style="display:none;">上传</div>
							</td>
						</tr>
						<tr class="weigui" >
							<td colspan="4">
								<!-- 附件上传 巡检———违规现象。。。--> <!-- 缩略图容器 -->
								<div id='list_wgxx'></div>
							</td>
						</tr>
					</c:if>
				</table>
			</div>
		</div>
		<input type="hidden" id="entityId_id" name="id" value="${requestScope.dm.id }"/>
		<input type="hidden" id="apId" name="apId" value="${requestScope.apId }"/>
		<c:if test="${requestScope.notPassExamine}">
			<!-- 修改时添加变更说明 -->
			<div style="margin:10px;" id="approvalRemark">
				审批意见<textarea rows="3" name="approvalRemark"style="width:70%"></textarea><span style="color:red;">*</span>
			</div>
			<div style="width:100%;text-align:center; padding-top:0px">
				<button class="btn btn-danger radius my-btn"
					onclick="saveMan(0)" type="button">同意</button>
				<button class="btn btn-default radius"
					onclick="saveMan(1)" type="button">拒绝</button>
			</div>
		</c:if>
	</div>

</body>
<script type="text/javascript">
	$(function(){
		getFiles();
	})
</script>
</html>
